const { DataTypes } = require('sequelize');
const sq = require('./db.js')   
const moment = require('moment')
const articleAndLable = sq.define('article_lable', {
        article_id: {
          type: DataTypes.INTEGER,
          require: true,
          comment: "文章id",
        },
        lable_id: {
          type: DataTypes.INTEGER,
          require: true,
          comment: "标签id",
        },   
        createdAt: {
            type: DataTypes.DATE,
            get() {
              return moment(this.getDataValue("createdAt")).format("YYYY-MM-DD HH:mm:ss")
            },
          },
          updatedAt: {
            type: DataTypes.DATE,
            get() {
              return moment(this.getDataValue("updatedAt")).format("YYYY-MM-DD HH:mm:ss")
            },
          },  
}, {    
  // 这是其他模型参数
  freezeTableName: true,
});
/* articleAndLable.sync({ force: true }) */
module.exports = articleAndLable;